#pragma once

#include <vector>
#include "MaterialDownloadEvent.h"
#include "ReadConfig.h"
#include "ListInfo.h"
#include "ListWindowWnd.h"
#include "BalloonTipsWindow.h"


#define WM_STOCKMESSAGE 0x0406

#define  FRAMEWINDOWS_WIDTH  614
#define  FRAMEWINDOWS_HEIGHT 378
#define  FRAMEWINDOWS_SMALL_HEIGHT 128

#define  FRAMEWINDOWS_MINIMIZE WM_USER + 100011

//typedef enum {PROCESS = 0,ERROR = 1}TASKCALLBACKSTATE;

class CMinimizeButton;
class CCloseButton;

class CFrameWindowWnd:public INotifyUI//:public CWindowWnd,
{
public:
	CFrameWindowWnd(void);
	//CFrameWindowWnd(HINSTANCE hInstance);
	virtual ~CFrameWindowWnd(void);
	virtual HWND Create(HINSTANCE hInstance,HWND hwndParent,LPCTSTR pstrName,DWORD dwStyle,DWORD dwExStyle,const RECT rc);
	virtual HWND Create(HWND hwndParent,LPCTSTR pstrName,DWORD dwStyle,DWORD dwExStyle,const RECT rc);
	void CreateControlPage(CStdString sName);
	void HideStock();
	void ShowStock();
	void ModifyStock();
	LPCTSTR GetWindowClassName() const;
	UINT GetClassStyle() const;
	void OnFinalMessage(HWND hWnd);
	void Notify(TNotifyUI& msg);
	//LRESULT HandleMessage(UINT uMsg,WPARAM wParam,LPARAM lParam);
	BOOL GetConfigInfo();
	void ShowStockWindow();
	void HideStockWindow();
	void CreateBalloonTipsWindow(RECT rc);
	void ShowBalloonTipsWindow();
	void HideBalloonTipsWindow();
	static LRESULT CALLBACK _WndProc(HWND hWnd,UINT uMsg,WPARAM wParam,LPARAM lParam);
	virtual LRESULT CALLBACK WndProc(HWND hWnd,UINT uMsg,WPARAM wParam,LPARAM lParam);
	void PostSelectedCount();
	void PostDownloadSuccessedCount();
	void PostSetupSuccessedCount();
public:
	HWND m_hWnd;
protected:
	void RunTask();
	void StopTask();
private:
	bool RegisterWindowClass();
	
	void InitWindow();
	void SetupFinishNotify(bool bIsAllDownloadFaild);
	//LPCTSTR GetDialogResource() const;
private:
	bool m_bIsInitWindow;
	HWND m_hWndClient;
	HINSTANCE m_hInstance;
	CReadConfig* m_pReadConfig;
	CMaterialDownloadEvent* m_pEvent;
	std::vector<CListInfo> m_NodeInfo;
	CListWindowWnd* m_pList;
	CBalloonTipsWindow* m_pBalloon;
	CMinimizeButton* m_pMinimize;
	CCloseButton* m_pClose;
	HBITMAP m_hBackGround;
	BITMAP  m_BitmapInfo;
	int m_nDownloadSuccessed;
	int m_nDownloadFailed;
	int m_nSetupSuccessed;
	int m_nSetupFailed;
	//bool    m_bIsSmallRect;
	//CPaintManagerUI m_pm;
	CStdString m_strSelectedID;
	CStdString m_strDownloadSuccessedID;
	CStdString m_strSetupSuccessedID;
	
};
